/*
 * 	Flan.Zeng 2011-2016	http://git.oschina.net/signup?inviter=flan
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.flan.stock.fragment;

import com.flan.stock.R;
import com.flan.stock.activity.FastTestActivity;
import com.flan.stock.activity.HSAStockActivity;
import com.flan.stock.activity.QuotationActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.Toast;

/**
 * 首页导航中的Fragment
 * @author flan
 * @date   2015年10月21日
 */
public class FragmentNavigatorA extends Fragment {
	
	private Context context;
	
	private Button but1,but2,but3,but4,but5,but6,but7,but8;
	
	
	public FragmentNavigatorA(Context context) {
		super();
		this.context = context;
	}

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
		
		View view = inflater.inflate(R.layout.fragment_navigator_a, null);
		
		but1 = (Button) view.findViewById(R.id.but_1);
		but2 = (Button) view.findViewById(R.id.but_2);
		but3 = (Button) view.findViewById(R.id.but_3);
		but4 = (Button) view.findViewById(R.id.but_4);
		but5 = (Button) view.findViewById(R.id.but_5);
		but6 = (Button) view.findViewById(R.id.but_6);
		but7 = (Button) view.findViewById(R.id.but_7);
		but8 = (Button) view.findViewById(R.id.but_8);
		
		MyListener listener = new MyListener();
		
		but1.setOnClickListener(listener);
		but2.setOnClickListener(listener);
		but3.setOnClickListener(listener);
		but4.setOnClickListener(listener);
		but5.setOnClickListener(listener);
		but6.setOnClickListener(listener);
		but7.setOnClickListener(listener);
		but8.setOnClickListener(listener);
		
		return view;
	}
	
	class MyListener implements OnClickListener{

		@Override
		public void onClick(View v) {
			Intent intent = null;
			switch (v.getId()) {
			case R.id.but_1:
				
				intent = new Intent(context, FastTestActivity.class);
				context.startActivity(intent);
				Toast.makeText(context, "测试入口被点击了~", Toast.LENGTH_SHORT).show();
				
				break;
			case R.id.but_2:
				
				intent = new Intent(context, QuotationActivity.class);
				intent.putExtra("currentItem", 0);
				context.startActivity(intent);
				
				break;
			case R.id.but_3:
				intent = new Intent(context, QuotationActivity.class);
				intent.putExtra("currentItem", 1);
				context.startActivity(intent);
				break;
			case R.id.but_4:
				intent = new Intent(context, HSAStockActivity.class);
				context.startActivity(intent);
				break;
			case R.id.but_5:
				
				break;
			case R.id.but_6:
				
				break;
			case R.id.but_7:
				
				break;
			case R.id.but_8:
				
				break;
			}
		}
		
	}

}












